package com.gexiaobao.pigeon.ui.view

import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView

/**
 * @Author      : hxw
 * @Date        : 2025/1/9 8:50
 * @Describe    :
 */
class VerticalTextView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : AppCompatTextView(context, attrs, defStyleAttr) {
    override fun onDraw(canvas: Canvas) {
        canvas.save()
        canvas.translate(width.toFloat(), 0f)
        canvas.rotate(90f) // 将画布旋转 90 度
        canvas.translate(0f, -height.toFloat()) // 调整位置
        super.onDraw(canvas)
        canvas.restore()
    }
}